headerbar: fix leak of start_box/end_box
authorAlan Jenkins <alan.christopher.jenkins@gmail.com>
Wed, 12 Oct 2016 17:03:43 +0000 (18:03 +0100)
committerMatthias Clasen <mclasen@redhat.com>
Thu, 13 Oct 2016 13:39:01 +0000 (09:39 -0400)
gtk_widget_destroy() removes widgets from their container.  However
_internal_ widgets must be unref'ed using gtk_widget_unparent() instead.
This is symmetric with the fact that these widgets were ref'ed by direct
call to gtk_widget_set_parent().  It's also the method that was used in
gtk_headerbar_destroy().

https://bugzilla.gnome.org/show_bug.cgi?id=772859

gtk/gtkheaderbar.c

index 51546754ee9407c5ddf75d05afee026f592766e2..ce67c10ba99946a0973b757e2e9180d27851bfe3 100644 (file)
@@ -282,13 +282,13 @@ _gtk_header_bar_update_window_buttons (GtkHeaderBar *bar)
 
   if (priv->titlebar_start_box)
     {
-      gtk_widget_destroy (priv->titlebar_start_box);
+      gtk_widget_unparent (priv->titlebar_start_box);
       priv->titlebar_start_box = NULL;
       priv->titlebar_start_separator = NULL;
     }
   if (priv->titlebar_end_box)
     {
-      gtk_widget_destroy (priv->titlebar_end_box);
+      gtk_widget_unparent (priv->titlebar_end_box);
       priv->titlebar_end_box = NULL;
       priv->titlebar_end_separator = NULL;
     }